<!DOCTYPE html>
<html lang="en">
<head>
    <meta charset="UTF-8">
    <meta http-equiv="X-UA-Compatible" content="IE=edge">
    <meta name="viewport" content="width=device-width, initial-scale=1.0">
    <title>Document</title>
    <style>
        #root,.box {
            background: rgba(0, 0, 0, .4);
            margin: 10px;
        }
        #root div,.box div {
            width: 20px;
            height: 20px;
            margin: 5px;
            background-color: pink;
        }
    </style>
</head>
<body>
    <div id="root">
    </div>
    <div class="box">
        <div></div>
        <div></div>
    </div>
    <script>
        var root = document.querySelectorAll('#root div')
        var root = document.getElementById('root')
        var box = document.querySelector('.box').getElementsByTagName('div')
        // console.log(root,box);
  
        // var str = document.createElement('div')
        // root.append(str)
        root.insertAdjacentHTML('beforeend','<div></div>')
        console.log(document.querySelectorAll('#root div'));
        root.insertAdjacentHTML('beforeend','<div></div>')
        console.log(document.querySelectorAll('#root div'));
        // console.log(root.getElementsByTagName('div'));
        // root.insertAdjacentHTML('beforeend','<div></div>')
        // root.insertAdjacentHTML('beforeend','<div></div>')
    </script>
</body>
</html>